import time

def bubble_sort(arr):
    for i in range(len(arr)):
        for j in range(len(arr) - i - 1):
            if arr[j] > arr[j+1]:
                arr[j], arr[j+1] = arr[j+1], arr[j]
    return arr

for file in ["m1_sorted.txt", "m2_reverse.txt", "m3_shuffle.txt"]:
    arr = []
    with open(file, "rt") as fileIO_:
        for line in fileIO_:
            arr.append(int(line.strip()))


    start = time.perf_counter()
    bubble_sort(arr)
    finish = time.perf_counter()
    print(f"{''.join(str(file).split('.')[:-1])} {int((finish - start) * 1000)} milliseconds")
